<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 生成一个map
    // map可以接收一个数组作为参数，该数组的成员是一个个表示键值对的数组
    // 语法：new Map([ [k,v], [k,v], [k,v], , ,,, ])
    /* new Map([
        [k, v], 
        [k, v], 
        [k, v], 
        , , , ,
    ]) */

    // let m=new Map([
    //     ["name","zs"],
    //     ["age",18],
    //     ["sex","男"]
    // ])
    // console.log(m);//Map(3) {'name' => 'zs', 'age' => 18, 'sex' => '男'}
    
    /* Map(3) {'name' => 'zs', 'age' => 18, 'sex' => '男'}
         [[Entries]]
            0: {"name" => "zs"}
                key: "name"
                value: "zs"
            1: {"age" => 18}
                key: "age"
                value: 18
            2: {"sex" => "男"}
                key: "sex"
                value: "男" */




    // map的键可以是任何的数据类型
    let m=new Map([
        [1,2],
        ["a","b"],
        [null,undefined],
        [ [1,2] , {name:'zs'} ]
    ])
    console.log(m);
    //{1 => 2, 'a' => 'b', null => undefined, Array(2) => {name:"zs"}}
    
    /* Map(4) {1 => 2, 'a' => 'b', null => undefined, Array(2) => {…}}
        [[Entries]]
            0: {1 => 2}
                key: 1
                value: 2
            1: {"a" => "b"}
                key: "a"
                value: "b"
            2: {null => undefined}
                key: null
                value: undefined
            3: {Array(2) => Object}
                key: (2) [1, 2]
                value: {name: 'zs'} */




</script>